package com.f6.weixin.utils;

import java.util.concurrent.ConcurrentHashMap;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class F6WXSessionUtil {
	private Logger logger = LoggerFactory.getLogger(F6WXSessionUtil.class);
	private static final F6WXSessionUtil util = new F6WXSessionUtil();

	private F6WXSessionUtil() {

	}

	private static ConcurrentHashMap<String, SessionItem> table = new ConcurrentHashMap<String, SessionItem>();

	public static F6WXSessionUtil getInstance() {
		return util;
	}

	public void put(String key, SessionItem value) {
		logger.info("&&&&&&&&&&&&&& " + key + " in to session  " + value);
		table.put(key, value);

	}

	public SessionItem get(String key) {
		SessionItem item = table.get(key);
		logger.info("&&&&&&&&&&&&&& " + key + " out of session  " + item);
		return item;
	}

	public void remove(String key) {
		logger.info("&&&&&&&&&&&&&&" + key + " remove from session");
		table.remove(key);
	}
}
